#pragma once
#include"MyHashTable.h"
using namespace hash_bucket;
namespace bit {

	template<class K>
	class MySet { 
		typedef HashNode<K> Node;

	public:
		struct MyKeyOfTSet {
			const K& operator()(const K& key) {
				return key;
			}
		};

		MySet() = default;
		~MySet() {
			_set.~HashTable();
		}
		bool Insert(const K& k) {
			return _set.Insert(k);
		}
		bool Find(const K& k) {
			return _set.Find(k);
		}
		bool Erase(const K& k) {
			return _set.Erase(k);
		}
		void Printf() {
			vector<Node*> tables = _set.GetVector();
			for (auto x : tables) {
				Node* cur = x;
				if (!cur)
					cout << "nullptr";
				while (cur) {
					cout << cur->_data<< ' ';
					cur = cur->_next;
				}
				cout << endl;
			}
		}
	private:
		HashTable<K, K, MyKeyOfTSet> _set;
	};

}
